//
//  MainState.h
//  trail-map-editor
//
//  Created by Tino Giorgio on 12/9/13.
//
//

#if !defined(MainSTATE_H)
#define MainSTATE_H

#include <plib/ssgAux.h>

/* Application Includes*/
#include "State.h"

/* DEFINES */
class Sector;
class Map;

class MainState : public State
{
public:
	MainState();
	virtual ~MainState();
	
	// class 'callbacks' (they aren't callbacks really...)
	void load(const char* filename);
    void display(void);
    void resize(int w, int h);
    void keyUp(unsigned char key, int x, int y);
    void keyDown(unsigned char key, int x, int y);
    void specialUp(int key, int x, int y);
    void specialDown(int key, int x, int y);
    void motion(int newx, int newy);
    void passive(int newx, int newy);
    void mouse(int button, int state, int mouseX, int mouseY);
    State* idle(void);
	
	// uiSceneDelegate
	virtual void onCallback(const uiScene* scene, const uiView* view, const char* name, puObject* object);
	virtual void onActiveCallback(const uiScene* scene, const uiView* view, const char* name, puObject* object);
	virtual void onDownCallback(const uiScene* scene, const uiView* view, const char* name, puObject* object);
	
private:
	uiValuator(float, heading)
    uiValuator(float, pitch)
    uiValuator(float, roll)
    
    uiProperty(uiSlider, xSlider)
    uiProperty(uiSlider, ySlider)
    uiProperty(uiSlider, zoomSlider)
	uiProperty(uiDial,headingDial)
    uiProperty(uiDial,pitchDial)
    uiProperty(uiDial,rollDial)
    uiProperty(uiInput,headingInput)
    uiProperty(uiInput,pitchInput)
    uiProperty(uiInput,rollInput)
    uiProperty(uiSlider, uSlider)
    uiProperty(uiSlider, vSlider)
    uiProperty(uiOneShot, loadDEMButton)
	uiProperty(uiOneShot, loadSSGButton)
	uiProperty(uiOneShot, saveSSGButton)
    uiProperty(uiOneShot, exitButton)
    uiProperty(uiButton, wireframeButton)
    uiProperty(uiButton, projectionButton)
    uiProperty(uiFileSelector, fileSelector)
	uiProperty(uiSelectBox, mapSelectBox)
	uiProperty(uiSelectBox, sectorSelectBox)
    
    bool mOrthoCamera;
    sgCoord mCameraCoord; // Camera zoom only
    sgCoord mSectorCoord; // Sector rotation
    
    ssgTransform mSectorTransform;
    Map* mMap;
	Sector* mSector;
	
	void _loadSector(const char* name);
};

#endif // !defined(MAINSTATE_H_)
